The present invention relates to rendering strokes, including glyphs formed from one or more strokes.
A character is an abstract construct that often represents an atomic unit in some system of expression, such as a language. Each character can be represented by a set of character attributes that define the semantic information of the character. A character encoding associates the set of character attributes for a character with a particular encoding value—for example, a scalar value included in a character set standard, such as ASCII (American Standard Code for Information Interchanges) or Unicode.
A glyph is a visual representation of a character, such as a graphical token or symbol, and includes one or more strokes, which may be vertical or horizontal (sometimes referred to as vertical and horizontal stems), curved or angled. A glyph image is a particular image of a glyph that has been rasterized or otherwise imaged onto some display surface. A font is a collection of glyphs, and can include a mapping of the collection of glyphs to corresponding characters (i.e., to encoding values). A font is typically constructed to support a character set standard. That is, fonts include glyphs representing characters included in the character set standard. A glyph can be associated with a set of glyph attributes defining appearance information for a representation of the corresponding character, and the glyph provides the information necessary to render a corresponding glyph image. A glyph can include, or can be associated with, a set of instructions for rendering the glyph. For example, TrueType™ fonts, available from Microsoft Corporation of Redmond, Wash., include glyphs that are associated with a set of instructions for use when rendering the glyph.
Hinting is a method of defining which pixels are turned on in order to create the best possible glyph bitmap shape, particularly at small sizes and low resolutions. A glyph's outline determines which pixels will constitute the bitmap. It is often necessary to modify the outline to create the bitmap, i.e., modify the outline until the desired combination of pixels is turned on. The modified outline can be referred to as a hinted outline. In certain fonts, such as TrueType fonts, a hint is a mathematical instruction that is included in the font program that defines a distortion of a glyph's outline at particular sizes. In other fonts, such as Type 1 fonts available from Adobe Systems Incorporated (“Adobe”) of San Jose, Calif., a glyph outline may be hinted according to various hinting policies. Hinting of Type 1 fonts is described in Section 5 of a manual entitled “Adobe Type 1 Format”, Version 1.1 available from Adobe. The term “Type 1” as used herein includes font/glyph definitions that are derived from or an enhancement of the Adobe Type 1 font format.
Certain types of visual output devices for computer systems are capable of outputting in “gray scale”. That is, each of the pixels in the raster matrix of the output device is capable of displaying a number of tones, typically from pure light to pure dark (which may or may not be shades of gray, per se). Anti-aliasing is a technique of varying the gray scale or color values of the pixels representing a glyph image to provide the illusion of smoother curves and less jagged diagonal lines.
As illustrated in FIGS. 1 and 2, an anti-aliasing technique can downsample a high resolution bitmap 105 to generate a gray scale representation 205 of a glyph image, the gray scale representation having varying tones of gray. For example, the ratio of the high resolution of the bitmap to the device resolution can be 4 to 1 in both x and y directions, illustrated by the grid 110 shown in FIG. 1, which grid corresponds to the device resolution. The device resolution is the maximum number of individual pixels that can be displayed on the device used to display the corresponding glyph image, and may be expressed as “dots per inch”, e.g., 96 dpi.
Before digital typography and scalable type, a font typically had a unique design for each glyph at each size. While the designs at different sizes were similar, important differences existed. As the size of a glyph became smaller, the relative size of the stems increased and the relative spacing between glyphs increased. These differences can be collectively referred to as optical compensation. However, with the advent of digital typography and the implications of “what you see is what you get” (WYSIWYG) and linear scaling, the optical size refinement in type design was largely lost. There are exceptions. For example, MultipleMaster fonts available from Adobe may have an optical size axis, or an individual type design can be implemented for different design sizes. However, even these techniques do not work well for final form documents that may be displayed at different zoom levels.
FIG. 3 shows this effect by comparing two variants of the letter “R” from the Type 1 SanvitoMM font. The SanvitoMM font contains four designs: a light 6 point design, a bold 6 point design, a light 72 point design and a bold 72 point design. The dotted outline 300 represents a glyph outline using the SanvitoMM light 6 point design, and the solid outline 305 represents a glyph outline using the SanvitoMM light 72 point design. For illustrative purposes, the outlines 300, 305 have been scaled to a common size so that the relative differences are more easily compared and have a common origin 310. The glyph outline 305 rendered at the 72 point size is positioned to the left (relative to the outline 300) and has a relatively smaller advance width 315 than the advance width 320 of the glyph outline 300 rendered at the 6 point size. The glyph outline 300 intended for the smaller point size has a relatively larger overall width and wider strokes. FIG. 3B shows the same two glyph outlines 300, 305 with their origins adjusted so that just the outline design differences may more easily be compared.
If, rather than drawing the glyph outline 300 using the SanvitoMM light 6 point design, the glyph outline 305 drawn using the SanvitoMM light 72 point design is scaled down to a 6 point size, the relative overall width will not be relatively larger nor will the strokes be relatively wider than the glyph outline drawn at 72 point size (because it is the same glyph outline). That is, the strokes will be too narrow (relatively speaking) when scaled down to a 6 point size. When applying conventional anti-aliasing techniques to such narrow strokes, the strokes tend to fade, which can adversely affect readability of the resulting displayed glyph. Adjustment techniques have been used to counter fading, such as an adjustment technique described in U.S. Pat. No. 5,929,866 to R. David Arnold entitled “Adjusting Contrast in Anti-Aliasing”. Arnold describes a technique for adjusting the density values of pixels representing a glyph up to the maximum density value available from the output device.